package com.cr.front.topic.controller;

import com.cr.common.response.JsonResult;
import com.cr.common.response.PageData;
import com.cr.front.topic.pojo.query.TopicQuery;
import com.cr.front.topic.service.TopicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(tags = "专题管理")
@RequestMapping("/topics")
public class TopicController {

    @Autowired
    private TopicService topicService;

    @GetMapping
    @ApiOperation(value = "获取专题列表")
    public JsonResult getList(TopicQuery topicQuery){

        return JsonResult.success(topicService.selectList(topicQuery));
    }
    @ApiOperation(value = "通过id获取专题")
    @GetMapping("/{id}")
    public JsonResult getById(@PathVariable Long id){

        return JsonResult.success(topicService.selectById(id));
    }
}
